package com.carl.utils;

import com.carl.enums.DataSources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**	Created by chenzhuo_m on 2018/8/24. **/

public class DataSourceSwitch {

	private static final ThreadLocal<DataSources> dataSourceTypes = new ThreadLocal<DataSources>(){
		@Override
		protected DataSources initialValue(){
			return DataSources.TEST;
		}
	};

	public static DataSources getDataSource(){
		return dataSourceTypes.get();
	}

	public static void setDataSource(DataSources dataSourceType){
		dataSourceTypes.set(dataSourceType);
	}

	public static void resetDataSource(){
		dataSourceTypes.set(DataSources.TEST);
	}


}
